package com.qf.lyw1225.springboot.controller;

import com.qf.lyw1225.springboot.entity.User;
import com.qf.lyw1225.springboot.service.LqUserService;
import com.qf.lyw1225.springboot.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @User userlq
 * @Date 2024/12/25 11:15
 * @Classname LqController
 * @Description TODO
 */
@Api(tags = "增删模块")
@RestController
@CrossOrigin
public class LqController {
    @Resource
    LqUserService lqUserService;

    /**
     * 按照id删除数据
     *
     * @param i
     * @return
     */
    @ApiOperation(value = "删除")
    @GetMapping("/lq/user/{id}")
    public Result delete(@PathVariable("id") Integer i) {
        return lqUserService.deleteById(i);
    }

    /**
     * 根据user类添加数据
     *
     * @param user
     * @return
     */
    @ApiOperation(value = "添加")
    @PostMapping("/lq/user")
    public Result insert(@RequestBody User user) {
        return lqUserService.insert(user);
    }
}
